package com.geeklan.smart.utils;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class FloatUtils {
    public static String roundTo1DecimalUsingBigDecimal(float value) {
        BigDecimal bd = new BigDecimal(Float.toString(value));
        bd = bd.setScale(1, RoundingMode.HALF_UP);
        return String.valueOf(bd.floatValue());
    }
    public static String roundTo0DecimalUsingBigDecimal(float value) {
        BigDecimal bd = new BigDecimal(Float.toString(value));
        bd = bd.setScale(0, RoundingMode.HALF_UP);
        return String.valueOf(bd.floatValue());
    }
}
